<?php

/**
 * NOTICE OF LICENSE
 *
 * THIS SOURCE FILE IS PART OF EVEBIT'S PRIVATE PROJECT.
 * 
 * DO NOT USE THIS FILE IN OTHER PLACE.
 *
 * @package     App_Backend
 * @subpackage  View
 * @author      Cheng Wei <berlios.o@gmail.com>
 * @version     $$Id: messages.phtml 20 2010-12-18 09:35:07Z cheng.wei $$
 */


$filename = 'application/modules/blocks/frontend-views/scripts/ajax-get-message.phtml';
$handle = fopen ( $filename, 'rb' );
if (filesize ( $filename )) {
	$content = fread ( $handle, filesize ( $filename ) );
} else {
	$content = null;
}
fclose ( $handle );

$session = $this->getSession ();
if (!$content){
	$session->clearMessages ();
}
$messages = $session->getMessages ();

$session->clearMessages ();
?>

<div id="content-wrapper" class="content-wrapper">
  <?php foreach ( $messages as $key => $msg ) :?>
  <?php if ($key !== count ( $messages ) - 1) continue?>
  <?php if ($msg ['level'] == 'error') :?>
  <div class="messages  error2 close">
    <ul class="message-list ">
      <h2>Oops!</h2>
      <p class="">
        <?php echo $msg->getMessage ()?>
      </p>
    </ul>
  </div>
  <?php else :?>
  <div class="messages  success close">
    <ul class="message-list ">
      <h2>Congratulations!</h2>
      <p class="">
        <?php echo $msg->getMessage ()?>
      </p>
    </ul>
  </div>
  <?php endif; ?>
  <?php endforeach; ?>
</div>
<script type="text/javascript">

$().ready(function() {
	$(".messages").each(function(i){
		var element=$(this);
		setTimeout(function(){
			element.fadeOut("slow");
		},4000);
	 });
});
//
</script> 
